//
//  ViewController.m
//  根据数据自动读取model的成员属性
//
//  Created by 李松 on 2017/11/23.
//  Copyright © 2017年 李松. All rights reserved.
//

#import "ViewController.h"
#import "NSObject+model.h"
#import "User.h"

@interface ViewController ()
/*数据*/
@property (nonatomic,strong) NSMutableArray <User*> *dataArray;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    NSString *path = [[NSBundle mainBundle] pathForResource:@"dataList.plist" ofType:nil];
    
    NSArray *dataArray = [[NSArray alloc] initWithContentsOfFile:path];
    
    //NSLog(@"%@", dataArray);
    [NSObject createPropertyCodeWithDic:dataArray[0]];
    
    for (NSDictionary *dic in dataArray) {
        User *user = [User userWithDic:dic];
        [self.dataArray addObject:user];
    }
    NSLog(@"%@", self.dataArray);
    
}

- (NSMutableArray<User *> *)dataArray{
    if (_dataArray == nil) {
        _dataArray = [NSMutableArray array];
    }
    return _dataArray;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
